﻿namespace CommLib
{
    enum RequestType
    {
        Unknown, ContactsList, SmsList, ThreadList, Conversation, SmsLatest, Calendar, CalendarList, CallLog
    }

    class MessageRequest : BluetoothMessage
    {
        public MessageRequest(RequestType type)
            : base(BtMessageType.Request, new string[] { ((int)type).ToString() })
        {
        }

        public MessageRequest(RequestType type, int intParam)
            : base(BtMessageType.Request, new string[] {
				((int)type).ToString(), intParam.ToString() })
        {
        }

        public MessageRequest(byte[] data, int length)
            : base(BtMessageType.Request, data, length)
        {
        }

        public RequestType getType()
        {
            int ordinal = int.Parse(mData[0]);

            if (ordinal >= 0)
                return (RequestType)ordinal;
            else
                return RequestType.Unknown;
        }

        public int getIntParam()
        {
            return int.Parse(mData[1]);
        }
    }
}
